<admintpl file="header" />
<style>
.col-md-6{width:45%;}
</style>
</head>
<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:U('BimModel/index')}">{:L('ADMIN_BIMMODEL_INDEX')}</a></li>
			<php>
				$role = session('Role');
				if(session('ADMIN_ID') == 1 || (session('deptid') == 1 && session('Role') != 1) || (session('deptid') == 3 && session('Role') != 1)){
			</php>
            <li><a href="{:U('BimModel/add')}">{:L('ADMIN_BIMMODEL_UPLOAD')}</a></li>
			<li><a href="{:U('BimModel/add_version')}">{:L('ADMIN_BIMMODEL_ADD_VERSION')}</a></li>
			<php>}</php>
			<li class="active"><a href="{:U('BimModel/edit')}">{:L('ADMIN_BIMMODEL_EDIT')}</a></li>
        </ul>
        <form method="post" class="form-horizontal js-ajax-form" action="{:U('BimModel/edit_post',array('id'=>$result['id']))}" >
           

            <div class="form-group">
                <label class="col-md-2 control-label"><span style="color:red;"> * </span>{:L('FILE_NAME')}</label>
                <div class="col-md-6">
                    <input type="text" class="form-control" name="file_name" value="{$result['file_name']}" placeholder="请输入图纸名称">
                </div>
            </div>
			<div class="form-group">
                <label class="col-md-2 control-label">{:L('ORDERNUM')}</label>
                <div class="col-md-6">
					<input class="form-control" name="ordernum" value="{$result['ordernum']}" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-md-2 control-label"><span style="color:red;"> * </span>{:L('TYPE')}</label>
                <div class="col-md-6">
                    <select name="type_id" class="form-control">
                        <foreach name="types" item="vo">
                            <option value="{$vo.id}" <php>if($vo['id'] == $result['type_id']){echo "selected='selected'";}</php>>{$vo.type_name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
			<div class="form-group">
                <label class="col-md-2 control-label">{:L('FIGURE_NUM')}</label>
                <div class="col-md-6">
                    <input type="text" class="form-control" name="figure_num" value="{$result['figure_num']}" placeholder="请输入图纸编号">
                </div>
            </div>
			<!--<div class="form-group">
                <label class="col-md-2 control-label">{:L('SHEET')}</label>
                <div class="col-md-6">
                    <input type="text" class="form-control" name="sheet" value="{$result['sheet']}">
                </div>
            </div>
			<div class="form-group">
                <label class="col-md-2 control-label">{:L('SHEETS')}</label>
                <div class="col-md-6">
					<input class="form-control" name="sheets" value="{$result['sheets']}" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                </div>
            </div>-->
			
            <div class="form-group">
                <label class="col-md-2 control-label"><span style="color:red;"> * </span>{:L('CONSTRUCTION')}</label>
                <div class="col-md-6">
                    <select name="construction_id" class="form-control" id="const">
                        <option value="1" <php>if($result['construction_id'] == 1){echo "selected='selected'";}</php>>方案阶段</option>
                        <option value="2" <php>if($result['construction_id'] == 2){echo "selected='selected'";}</php>>扩初阶段</option>
                        <option value="3" <php>if($result['construction_id'] == 3){echo "selected='selected'";}</php>>施工图阶段(设计)</option>
						<option value="4" <php>if($result['construction_id'] == 4){echo "selected='selected'";}</php>>施工图阶段(施工)</option>
                    </select>
                </div>
            </div>
			<div class="form-group">
                <label class="col-md-2 control-label">{:L('VERSION')}</label>
                <div class="col-md-6">
                    <select name="version_id" class="form-control" id="version_id">
                        <foreach name="versions" item="vo">
                            <option value="{$vo.id}" <php>if($vo['id'] == $result['version_id']){echo "selected='selected'";}</php> >{$vo.version_name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="form-actions col-md-10 col-md-offset-2">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:L('CONFIRM')}</button>
                <a class="btn btn-default" href="javascript:history.back(-1);">{:L('BACK')}</a>
            </div>
        </form>
    </div>
	<script src="__PUBLIC__/js/common.js"></script>
    <script>
	$(document).ready(function(e) {
			$("#const").on("change", function(){
				getSelectVal();
			});
			function getSelectVal(){
				$.getJSON("{:U('BimModel/get_versions')}",{construction_id:$("#const").val()},function(json){ 
					var version_id = $("#version_id"); 
					$("option",version_id).remove(); //清空原有的选项 
					$.each(json,function(index,array){ 
						var option = "<option value='"+array['id']+"'>"+array['version_name']+"</option>"; 
						version_id.append(option); 
					}); 
				});
			}
			
	});
	</script>
</body>
</html>